import Vue from 'vue';
import layer from 'vue-layer';
import 'vue-layer/lib/vue-layer.css';
import Message from '@/layouts/Message.vue';

const mylayer = layer(Vue);
let layerid = '';

export function doMessage(parent, reopen) {
  if (layerid) {
    if (!reopen) return;
    mylayer.close(layerid);
  }
  layerid = mylayer.iframe({
    content: {
      parent,
      content: Message
    },
    area: ['800px', '600px'],
    title: '我的私信',
    shadeClose: false,
    shade: false,
    cancel: () => { layerid = ''; }
  });
}
